#pragma once
#include <pthread.h>

class LockGuard
{
public:
    LockGuard(pthread_mutex_t *pmutex) : _pmutex(pmutex)
    {
        pthread_mutex_lock(_pmutex);
    }

    ~LockGuard()
    {
        pthread_mutex_unlock(_pmutex);
    }

private:
    pthread_mutex_t *_pmutex;
};